<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户信息</title>
</head>
<body>
个人管理：</br>
用户信息：</br>
用户名：<span id="username"></span></br>
所属类型：<span id="platform"></span></br>
用户身份：<span id="role"></span></br>
个人管理：</br>
修改密码：<input type="button" value="修改密码" onclick="updatePwd()"/>
<div class="modal" id="modi" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                修改密码
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">×</span><span class="sr-only">关闭</span>
                </button>
            </div>
            <section class="content">
                <div class="row">
                    <div class="panel-body" style="padding-bottom:0px; margin-top: -40px">
                        <div class="panel-body marpan">
                            <form id="modiForm" class="form-horizontal">
                                <input id="uid" type="hidden"/>
                                <div class="form-group3" style="margin-top: 15px">
                                    <label class="col-sm-12" for="password1">密码</label>
                                    <div class="col-sm-12">
                                        <input class="text" id="password1" type="password" placeholder="请输入密码"/>
                                    </div>
                                    <div class="col-sm-4" style="text-align: left; margin-top: 10px">
                                        <button type="button" class="btn btn-primary add" onclick="update()" value="修改">修改</button>
                                        <button type="button" class="btn btn-primary" data-dismiss="modal" value="关闭">关闭</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <!-- /.row -->
            </section>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    function updatePwd(){
        $('#modi').modal('show');
    }

    function update(){
        $('.cover').show();
        var param={"password":$('#password1').val()};
        $.ajax({
            type:"post",
            url:"/user/updatePwd",
            dataType:"json",
            data:param,
            success:function(res){
                $('.cover').hide();
                if(res.message){
                    alert(res.message);
                } else {
                    $('#modi').modal('hide');
                    refreshTable()
                }
            }
        });
    }

    $(function(){
        $.ajax({
            url:"/user/getUser",
            dataType:"json",
            success:function(res){
                $('.cover').hide();
                if(res.message){
                    alert(res.message);
                } else {
                    if(res.data){
                        $('#username').text(res.data.username);
                        $('#platform').text(res.data.platform);
                        $('#role').text(res.data.roles);
                    }
                }
            },
            error:function(){
            }
        });
    });
</script>
</html>
